<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>  
<c:set var="ctx" value="${pageContext.request.contextPath }" />
<link rel="stylesheet"
	href="${ctx }/resources/js/select2/select2.min.css" />
<script type="text/javascript"
	src="${ctx }/resources/js/select2/select2.min.js"></script>
<script type="text/javascript"
	src="${ctx }/resources/js/select2/zh-CN.js"></script>
	<script type="text/javascript">
	function shengcheng(){
		var  spreadName =[];
		obj = document.getElementsByName("spreadName");
		for(k in obj){
			if(obj[k].checked)
				spreadName.push(obj[k].value);
		}
		 var oriLink = $("input[name=oriLink]").val();
		 $.post("${ctx}/spreadlink/add.html",{spreadName:spreadName,oriLink:oriLink},function(data){
			 var text ="";
			 var json=eval("("+data+")");
			 $(json.linkList).each(
						function(i, item) {
							text +="<div style='height:50px;border-bottom:1px solid #438eb9;line-height:50px;overflow:hidden;' class='shortlink'><p><span>"+item+"</span></p></div>";
						});
			 $("#showURI").html($.parseHTML(text, document, true)); 
			/*  $($.parseHTML(text, document, true)).appendTo("#showURI"); */
		 });
	 }
$(function() {
	 
	 
	 
})
</script>
<%-- <script src="${ctx }/resources/js/upload/ajaxfileupload.js"
	type="text/javascript"></script> --%>
  

<style>
.iconShow
{
	padding-left: 10px; 
	padding-top: 3px;
}
.source-icon
{
	 width:95%;
	 float:left;
}
@media screen and (max-width: 374px){
	.source-icon
	{
		 width:82%;
	}
}
@media screen and (min-width: 375px) and (max-width: 449px){
	.source-icon
	{
		 width:85%;
	}
}
@media screen and (min-width: 450px) and (max-width: 1279px) {
	.source-icon
	{
		 width:90%;
	}
}
@media screen and (min_width: 1280px) {
	.source-icon
	{
		 width:90%;
	}
}
</style>
<div class="page-header">
	<h1>
		
		渠道推广短地址生成
	</h1>
</div>
<div class="row" style="margin-top: 5px;">
	<div class="col-xs-12">
		<!-- <form id="spreadName" name="spreadName" class="form-horizontal"  role="form" method="post"> -->
			 <c:if test="${!empty spread}">
				<%-- <input type="hidden" id="pageNum" name="pageNum" value="${page.pageNum }"> 
				<input type="hidden" id="pageSize" name="pageSize" value="${page.pageSize }"> 
				<input type="hidden" id="orderByColumn" name="orderByColumn" value="${page.orderByColumn }"> 
				<input type="hidden" id="orderByType" name="orderByType" value="${page.orderByType }"> --%>
				<input type="hidden"  id='id' name="id" value="${spread.id }">
			</c:if> 
          
			<div class="form-group">
				<label class="control-label col-sm-1 no-padding-right" for="name">选择渠道</label>
				<div class="row">
				<div class="col-sm-10">
				<div class="clearfix">
						<c:forEach items="${spreadNameList}" var="list" varStatus="s">
						<label style="margin-right:25px;float:left;">
						<input  name="spreadName" id="${list.code}" type="checkbox" value="${list.code}" style="vertical-align:middle;" />
						<a style="font-size:20px;vertical-align:middle;">${list.name}</a>
						</label>
						</c:forEach>
                </div>
				</div>
				</div>
            </div>
            <div class="form-group">
				<label class="control-label col-sm-1 no-padding-right" for="name">原连接地址</label>
				<div class="col-sm-10">
				<div class="clearfix">
					<input class="form-control" name="oriLink" id="oriLink" type="text"
						 placeholder="原连接地址" />
                </div>
				</div>
            </div>
             <div class="form-group">
				<div class="col-sm-10">
				<button onclick="javascript:shengcheng();">生&nbsp;&nbsp;&nbsp;成</button>
				</div>
				<div class="clearfix">
					
                </div>
            </div>
              		
              
			
	<!-- 	</form> -->
		<div class="row" style="margin-top: 5px;">
			<div style="padding:15px;border:1px solid #438eb9;border-radius:5px;" id="showURI" ></div>
		</div>
		<div class="hr hr-dotted"></div>
	</div>
</div>
<!-- <div class="center">
	<button id="btnAdd" type="button" 
	onclick="javascript:$('#spreadForm').submit();" 
	class="btn btn-success btn-sm">
		<i class="fa fa-user-plus"></i>&nbsp;
		
		保存
		
	</button>
	
</div> -->
 